#pragma once
#ifdef WIN32
	#include <WinSock2.h>
	#pragma comment(lib,"Ws2_32.lib")
	#define MSG_NOSIGNAL 0
	//WIN32
#else //Linux
	#include <sys/socket.h>
	#define INVALID_SOCKET  0
	#define SOCKET_ERROR    -1
#endif 


class SocketClient
{
public:
	SocketClient();
	~SocketClient();

	int Open(const char* szIp,unsigned short wPort);
	int Send(void* buf,unsigned int dwDataLen);
	int Recv(void* pBuffer,unsigned int dwLen,unsigned int dwTimeout=6000);
	void Close();
	bool IsOpened() const;
	int SetLastError() ;
	int GetLastError() const;
#ifndef WIN32 
	unsigned int GetTickCount();
#endif

private:
	int m_errno;
	int m_fd;
};
